<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>Scripts</title>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>

<body>

<div align="center">
<table class=allEncompassingTable >
 <tr>
  <td >
<p><a href="../index.html" TARGET="_top"><img src="images/homeImg.png"></a></p>



<h1>Scripts</h1>

<p>CoppeliaSim is a highly customizable simulator: almost every step of a <a href="simulation.htm">simulation</a> is user-defined. Additionally, the simulator itself can also be customized to a large extent. This flexibility is allowed through an integrated script interpreter. The scripting language is <a href="http://www.lua.org">Lua</a>, which is an extension programming language designed to support general procedural programming. For more information on Lua, refer to the <a href="luaCrashCourse.htm">Lua crash course</a> section and the <a href="http://www.lua.org">online documentation</a>. See <a href="acknowledgments.htm">here</a> for acknowledgments and credits related to Lua.<br>
</p>

<p align=center><img src="images/luaLogo.jpg"></p>
<p class=imageLabel>[Lua logo]</p>
<br>

<p>CoppeliaSim extends Lua's commands and adds CoppeliaSim specific commands that can be recognized by their <em>sim</em>-prefixes (e.g. <a href="regularApi/simGetObjectPosition.htm">sim.getObjectPosition</a>). For a list of all CoppeliaSim specific Lua-commands, refer to the <a href="apiFunctions.htm">regular API</a>. New, customized Lua-commands can also be registered from a <a href="plugins.htm">plugin</a>. Refer to the <a href="apiFunctions.htm#customizingLuaFunctions">related API-functions</a> for more information.<br>
</p>

<p>Lua's functionality itself can easily be extended by making use of a <a href="http://lua-users.org/wiki/LibrariesAndBindings">Lua extension library available online</a>.<br>
</p>

<p>Several types of scripts are supported in CoppeliaSim: <a href="sandboxScript.htm">the sandbox script</a>, <a href="addOns.htm">add-ons</a>, and <a href="embeddedScripts.htm">embedded scripts</a> (themselves composed of a <a href="mainScript.htm">main script</a>, <a href="childScripts.htm">child scripts</a> and <a href="customizationScripts.htm">customization scripts</a>). An embedded script is a script that is embedded in a <a href="scenes.htm">scene</a> (or <a href="models.htm">model</a>), i.e. a script that is part of the scene and that will be saved and loaded together with the rest of the scene (or model). On the other hand, the sandbox script and add-ons are not associated with any specific scene, model or object, and will run across all scenes in a similar way. </p>

<p align=center><img src="images/embeddedScripts.jpg"></p>
<p class=imageLabel>[Script types]</p>
<br>

<p>Scripts are invoked via <a href="callbackFunctions.htm">callback functions</a> by CoppeliaSim, and follow a <a href="scriptExecution.htm">specific execution order</a>. They can <a href="threadedAndNonThreadedCode.htm">run threaded or non-threaded</a>.</p>

<p>CoppeliaSim scripts may be published under any license.</p>
<br>
<br>
 </tr>
</table> 
</div>  
  
  
</body>

</html>
